<?php
require 'dbconnect.inc.php';
$firstname=$_POST["firstname"];
$lastname=$_POST["lastname"];
$password=$_POST["password"];
$emailid=$_POST['emailid'];
$profession=$_POST["Profession"];
$key=md5($emailid).md5($password);
$sql="INSERT INTO credential(firstname,lastname,password,emailid,Ekey,profession,status)
VALUES ('$firstname','$lastname','$password','$emailid','$key','$profession',0)";

if(!mysqli_query($link,$sql))
{
	die('Error: ' . mysqli_error($con));
}
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();  // telling the class to use SMTP
$mail->Host     = "localhost"; // SMTP server
$mail->From     = "vijayekalavya@gmail.com";
$mail->AddAddress("$emailid");
$mail->Subject  = "Confirmation email";
$mail->Body     = "Hi! \n\n click on this link for successfull registration to Crowd Sourced Text Book site \n http://localhost/project/verification.php?id=".$key;
$mail->WordWrap =50; 
if(!$mail->Send()) {

header('location:signup.html');
} 
else {
echo 'Link has been sent to your emailaddress.Click the reference for successful login';
}

mysqli_close($con);

?>